home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIMIMEService.idl < prev    next >
Text File  |  2006-05-08  |  4KB  |  107 lines

  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39. #include "nsIMIMEInfo.idl"
  40. #include "nsIURI.idl"
  41. #include "nsIFile.idl"
  42.  
  43. %{C++
  44. #define NS_MIMESERVICE_CID                           \
  45. { /* 03af31da-3109-11d3-8cd0-0060b0fc14a3 */         \
  46.     0x03af31da,                                      \
  47.     0x3109,                                          \
  48.     0x11d3,                                          \
  49.     {0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
  50. }
  51. %}
  52.  
  53. /**
  54.  * The MIME service is responsible for mapping file extensions to MIME-types
  55.  * (see RFC 2045). It also provides access to nsIMIMEInfo interfaces and
  56.  * acts as a general convenience wrapper of nsIMIMEInfo interfaces.
  57.  *
  58.  * The MIME service maintains a database with a <b>one</b> MIME type <b>to many</b>
  59.  * file extensions rule. Adding the same file extension to multiple MIME types
  60.  * is illegal and behavior is undefined.
  61.  *
  62.  * @see nsIMIMEInfo
  63.  */
  64. [scriptable, uuid(5b3675a1-02db-4f8f-a560-b34736635f47)]
  65. interface nsIMIMEService : nsISupports {
  66.     /**
  67.      * Retrieves an nsIMIMEInfo using both the extension
  68.      * and the type of a file. The type is given preference
  69.      * during the lookup. One of aMIMEType and aFileExt
  70.      * can be an empty string. At least one of aMIMEType and aFileExt
  71.      * must be nonempty.
  72.      */
  73.     nsIMIMEInfo getFromTypeAndExtension(in ACString aMIMEType, in AUTF8String aFileExt);
  74.  
  75.     /**
  76.      * Retrieves a ACString representation of the MIME type
  77.      * associated with this file extension.
  78.      *
  79.      * @param  A file extension (excluding the dot ('.')).
  80.      * @return The MIME type, if any.
  81.      */
  82.     ACString getTypeFromExtension(in AUTF8String aFileExt);
  83.  
  84.     /**
  85.      * Retrieves a ACString representation of the MIME type
  86.      * associated with this URI. The association is purely
  87.      * file extension to MIME type based. No attempt to determine
  88.      * the type via server headers or byte scanning is made.
  89.      *
  90.      * @param  The URI the user wants MIME info on.
  91.      * @return The MIME type, if any.
  92.      */
  93.     ACString getTypeFromURI(in nsIURI aURI);
  94.     
  95.     //
  96.     ACString getTypeFromFile(in nsIFile aFile);
  97.  
  98.     /**
  99.      * Given a Type/Extension combination, returns the default extension
  100.      * for this type. This may be identical to the passed-in extension.
  101.      *
  102.      * @param aMIMEType The Type to get information on. Must not be empty.
  103.      * @param aFileExt  File Extension. Can be empty.
  104.      */
  105.     AUTF8String getPrimaryExtension(in ACString aMIMEType, in AUTF8String aFileExt);
  106. };
  107.